package com.leolian.spring01.beanannotation.javabased;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;

@Configuration
@ImportResource("classpath*:spring-beanannotation.xml")
public class ConfigStore {
	
	/*@Bean(name="integerStore",initMethod="init",destroyMethod="destory")
	public Store<Integer> getIntegerStore(){
		return new IntegerStore();
	}
	
	@Value("${jdbc.url}")
	private String url;
	
	@Value("${jdbc.username}")
	private String username;
	
	@Value("${jdbc.password}")
	private String password;
	
	@Bean(name="myDriverManager")
	public MyDriverManager getMyDriverManager(){
		return new MyDriverManager(url,username,password);
	} */
	@Autowired
	private StringStore store1;
	
	@Autowired
	private IntegerStore store2;
	
	
	@Bean
	public StringStore getStringStore(){
		return new StringStore();
	}
	
	@Bean
	public IntegerStore getIntegerStore(){
		return new IntegerStore();
	}
	
	@Bean(name="store")
	public Store getStore(){
		//System.out.println(store1.getClass().getName());
		//System.out.println(store2.getClass().getName());
		return new Store<Byte>(){};
	}
	
	
	
}
